 <? include("/inc/header.html") {} ?>
 
 <div class="col-lg-5">
   	<div class="panel" overflow: auto;">
          <div class="panel-body pan "style="width:auto; overflow: auto;" >
			<div class="form-body pal" style="float:left;width:100%; overflow: auto;"  >
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">菜单名称
						<span class='require' id="zhongwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon" >
							<input id="name" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">菜单描述
						<span class='require' id="yingwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="description" type="text"  class="form-control"  />
						</div>
					</div>
				</div>
				
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">URL
						<span class='require' id="bianhao">*</span></div>
                                      </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="url" type="text" class="form-control" />
						</div>
					</div>
				</div>

				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">标头
						<span class='require' id="paixu">*</span></div>
                     </label>
						<div class="col-md-7">
						<div class="input-icon">
							<input id="headline" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">排序
						<span class='require' id="paixu">*</span></div>
                     </label>
						<div class="col-md-7">
						<div class="input-icon">
							<input id="sort" type="text" class="form-control" />
						</div>
					</div>
				</div>
					<div>
						<label for="inputUsername" class="col-md-3 control-label">
					 		<div align="right">状态
								<span class='require' id="paixu">*</span></div>
                    	 </label>
						<div class="col-md-9">
							<div class="input-icon">
								<select id="stauts" class="form-control">
									<option value="0">启用</option>
									<option value="1">禁用</option>
								</select>
							</div>
						</div>
					</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">父节点<span
						class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-group input-group-sm mbs">
							<input id="parentclassname" type="text" class="form-control" disabled="true" /> 
							<span class="input-group-btn">
							<button onclick="menuZTree()" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择...</button>
							</span> 
							<input id="parentClassid" type="hidden" class="form-control" />
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
  </div>
</div>
<script>
var ztreeId = window.parent.getzTreeid();
$(function() {
	 $.ajax({
			type : "post",
			data : {
				"id":ztreeId
			},
			url : "knowledgeEditDataEditMent.do",
			dataType : "json",
			beforeSend : function(XMLHttpRequest) {
			},
			success : function(data){
				 $("#name").val(data[0].name);
				 $("#url").val(data[0].url);
           		 $("#description").val(data[0].description);
           		 $("#level").val(data[0].level);
           		 $("#parentClassid").val(data[0].parentId); 
           		 $("#parentclassname").val(data[0].parentName); 
           		 $("#stauts").val(data[0].status); 
           		 $("#headline").val(data[0].headline); 
           		 $("#sort").val(data[0].sort); 
			},
		});
	});

		//选择父类
		function menuZTree() {
		parent.layer.open({
			type : 2,
			area : [ '560px', '600px' ],
			fix : false, //不固定
			scrollbar : false,
			shadeClose : true,
			//move : false,
			title:"选择父节点",
			skin : 'layui-layer-rim', //加上边框
			btn : [ '保存 ', '关闭' ],
			content : ["knowledge-edit-data-menu-zTree.html?winName="+window.name, 'no'],
			yes : function(index,layer) {		
			 var iframeWin = parent.window[layer.find('iframe')[0]['name']];
			  			  iframeWin.save();
			},
			cancel : function(index) {
			}
		});
	}
	function save(){   
		$.ajax({
			type : "post",
			url : "knowledgeEditDataUploadMent.do",
			dataType : "json",
			data:{
				"name":$("#name").val(),
				"description":$("#description").val(),
				"url":$("#url").val(),
				"level":$("#level").val(),
				"stauts":$("#stauts").val(),
				"parentid":$("#parentClassid").val(),
				"sort":$("#sort").val(),
				"headline":$("#headline").val(),
				"id" :ztreeId,
				
			},
			beforeSend : function(XMLHttpRequest) {},
			success: function padlock() {  
           		 var index = parent.layer.getFrameIndex(window.name); 
           		 window.parent.initTree();
           		 parent.layer.msg('编辑成功！');
            	 parent.layer.close(index); 
    		}
			});
    } 
</script>

